package com.example.starter.exception;

/**
 * Created by liuw on 2017/11/14.
 */
public class CheckedException extends RuntimeException {

    private int errorCode = 400;

    private String message = null;

    public CheckedException(ErrorCode errorCode) {
        this.errorCode = errorCode.getCode();
        this.message = errorCode.getMessage();
    }

    public CheckedException(int errorCode, String message) {
        this.errorCode = errorCode;
        this.message = message;
    }

    public CheckedException(int errorCode, String message, Throwable cause) {
        super(cause.getMessage(), cause);
        this.errorCode = errorCode;
        this.message = message;
    }

    public CheckedException(int errorCode, String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
        super(cause.getMessage(), cause, enableSuppression, writableStackTrace);
        this.errorCode = errorCode;
        this.message = message;
    }
}
